package com.hmdp.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.stream.Collectors;

class Main {

    public static boolean state[] = new boolean[50];
    public static int flag = 0;
    public static int count = 0;
    public static int n;
    public static int c;

    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String[] strS = bufferedReader.readLine().split(" ");
        int n = Integer.valueOf(strS[0]);
        int m = Integer.valueOf(strS[1]);

        strS = bufferedReader.readLine().split(" ");
        List<Integer> integerList = Arrays.stream(strS).map(Integer::new).collect(Collectors.toList());

        for (int i = 0; i < m; i++) {
            int k = Integer.valueOf(bufferedReader.readLine());
            int l = -1, r = n;
            while (l + 1 != r) {
                int mid = l + r >> 1;
                if (integerList.get(mid) >= k) r = mid;
                else l = mid;
            }
            if (r>=n||integerList.get(r) != k) {
                System.out.println("-1 -1");
            } else {
                int ll = -1, rr = n;
                while (ll + 1 != rr) {
                    int mid = ll + rr >> 1;
                    if (integerList.get(mid) <= k) ll = mid;
                    else rr = mid;
                }
                System.out.println(r+" "+ll);
            }

        }
    }

//    public static void main(String[] args) throws IOException {
//        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
//        String[] g = new String[5];
//        for (int i = 1; i <= 4; i++) {
//            g[i] = bufferedReader.readLine();
//        }
//
//
//        char[][] gg = new char[5][5];
//
//        for (int i = 1; i <= 4; i++) {
//            for (int j = 0; j < 4; j++) {
//                gg[i][j + 1] = g[i].charAt(j);
//            }
//        }
//
//
//        int res = 0x3f3f3f3f;
//
//        ArrayList<String> path = new ArrayList<>();
//
//        for (int i = 0; i < (1 << 16); i++) {
//            ArrayList<String> tempPath = new ArrayList<>();
//            char[][] temp = new char[5][5];
//
//            for (int j = 1; j <= 4; j++) {
//                for (int k = 1; k <= 4; k++) {
//                    temp[j][k] = gg[j][k];
//                }
//            }
//
//            int now = 0;
//            for (int idx = 0; idx < 16; idx++) {
//                if ((i >> idx & 1) == 1) {
//                    int x = idx / 4 + 1;
//                    int y = idx % 4 + 1;
//                    tempPath.add(x+" "+y);
//                    turn(temp, x, y);
//                    now++;
//                }
//            }
//
//            boolean flag = true;
//            for (int k = 1; k <= 4; k++) {
//                for (int o = 1; o <= 4; o++) {
//                    if (temp[k][o] == '+') {
//                        flag = false;
//                        break;
//                    }
//                }
//            }
//            if (flag) {
//                path=tempPath;
//                res = Math.min(res, now);
//            }
//
//        }
//
//        System.out.println(res);
//        path.forEach((o)->{
//            System.out.println(o);
//        });
//
////        String[] s = bufferedReader.readLine().split(" ");
////        n = Integer.valueOf(s[0]);
////        dfs(0, 0);
////        System.out.println(c);
//    }

    public static void turn(char[][] g, int x, int y) {
        for (int i = 1; i <= 4; i++) {
            if (g[i][y] == '+') {
                g[i][y] = '-';
            } else {
                g[i][y] = '+';
            }

            if (g[x][i] == '+') {
                g[x][i] = '-';
            } else {
                g[x][i] = '+';
            }
        }
        if (g[x][y] == '+') {
            g[x][y] = '-';
        } else {
            g[x][y] = '+';
        }
    }

    public static void dfs(int u, int now) {

        if (u == 9 + 1) return;
        c++;

        if (u == 9) {
            String temp = new String(String.valueOf(now));
            for (int i = 1; i <= 7; i++) {
                for (int j = i + 1; j < 8; j++) {
                    try {
                        Integer a = Integer.valueOf(temp.substring(0, i));
                        Integer b = Integer.valueOf(temp.substring(i, j + 1));
                        Integer c = Integer.valueOf(temp.substring(j + 1, 9));
                        if ((n - a) * c == b) {
                            count++;
                        }
                    } catch (NumberFormatException e) {
                        System.out.println(e);
                    }
                }
            }


        }

        for (int i = 1; i <= 9; i++) {
            if (!state[i]) {
                state[i] = true;
                dfs(u + 1, now * 10 + i);
                state[i] = false;
            }
        }
    }


    public static void dfsC(int u, int c, int a, int b) {
        if (u == 9 + 1) return;


        if (c != 0 && flag == 9) {
            if ((n - a) * c == b) {
                count++;
            }
        }


        for (int i = 1; i <= 9; i++) {
            if (!state[i]) {
                state[i] = true;
                flag++;
                dfsC(u + 1, c * 10 + i, a, b);
                flag--;
                state[i] = false;
            }
        }
    }

    public static void dfsB(int u, int b, int a) {
        if (u == 9 + 1) return;

        if (b != 0)
            dfsC(0, 0, a, b);


        for (int i = 1; i <= 9; i++) {
            if (!state[i]) {
                state[i] = true;
                flag++;
                dfsB(u + 1, b * 10 + i, a);
                flag--;
                state[i] = false;
            }
        }
    }

    public static void dfsA(int u, int a) {

        if (u == 9 + 1) return;

        if (a < n && a != 0) {
            dfsB(0, 0, a);
        }

        for (int i = 1; i <= 9; i++) {
            if (!state[i]) {
                state[i] = true;
                flag++;
                dfsA(u + 1, a * 10 + i);
                flag--;
                state[i] = false;
            }
        }
    }


}